<?php
date_default_timezone_set('America/Sao_Paulo');

$filename = 'proc.tmp';
$datetime = Date('[d/m/Y - H:m:s]');
$content = $datetime." -- Iniciando contagem...\n<br />";
$handle = fopen($filename, 'w');
fwrite($handle, $content); 
fclose($handle);

for($i=0; $i <= 1000; $i++){
	$datetime = Date('[d/m/Y - H:m:s]');
	$content = $datetime." -- output: $i\n<br />";
	$handle = fopen($filename, 'a');
	fwrite($handle, $content); 
	fclose($handle);
		
	sleep(3);
}
?>